# Tanım: GTK2 arşivleyici programı
# URL: http://www.peazip.org/peazip-linux.html
# Paketçi: yasarciv67
# Gerekler: arc balz desktop-file-utils lib32-curl lib32-gmp4 lib32-gtk2 lib32-ncurses lpaq paq8o p7zip upx zpaq
quad unace

isim=peazip-gtk2
surum=6.6.0
devir=1
kaynak=(https://github.com/giorgiotani/PeaZip/releases/download/$surum/peazip-$surum.LINUX.GTK2.tgz
        https://aur.archlinux.org/cgit/aur.git/plain/peazip.install?h=peazip-gtk2
https://aur.archlinux.org/cgit/aur.git/plain/peazip.desktop?h=peazip-gtk2)


derle() {
  _pkgres="$PKG/usr/lib/peazip/res"
  install -Dm755 "$SRC/usr/local/share/PeaZip/peazip" \
                 "$PKG/usr/lib/peazip/peazip"

  cd "$SRC/usr/local/share/PeaZip/res"
  for _file in altconf.txt lang/*.txt pea pealauncher rnd themes/{*.7z,*-embedded/*}; do
    _octal=$(stat -c "%a" "$_file")
    install -Dm"${_octal}" "$_file" "$_pkgres/$_file"
  done
  cd "$SRC"

  ln -sf -T "/usr/lib/p7zip" "$_pkgres/7z"

  for _file in arc/{arc,marc} quad/{balz,quad} lpaq/lpaq8 paq/paq8o upx/upx unace/unace zpaq/zpaq; do
    install -d "$_pkgres/$(dirname $_file)/"
    ln -sf -T "/usr/bin/$(basename $_file)" "$_pkgres/$_file"
  done

  install -d "$PKG/usr/bin/"
  for _file in /usr/lib/peazip/{peazip,res/pea,res/pealauncher}; do
    ln -sf "$_file" "$PKG/usr/bin/$(basename $_file)"
  done

  install -Dm644 "$SRC/usr/local/share/icons/peazip.png" "$PKG/usr/share/pixmaps/peazip.png"
  desktop-file-install "$SRC/peazip.desktop" --dir "$PKG/usr/share/applications/"
}